home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
utils
/
attr100.arj
/
ATTR100.DOC
< prev
next >
Wrap
Text File
|
1994-01-09
|
24KB
|
510 lines
ATTR Version 1.00 by Thomas Dyas.
A file attribute utility to replace the DOS ATTRIB command.
Copyright (C) 1994 by Thomas Dyas. All rights reserved.
Table of Contents
-----------------
Introduction...........................1
Registration Information...............2
License Information....................2
Installation...........................2
What are file attributes?..............3
Basic syntax of an ATTR command........3
Viewing file attributes of a file......4
Setting the attributes of a file.......5
Command switches.......................6
Special notes and tips.................8
Technical Support......................9
Introduction
------------
ATTR is a utility designed to replace the ATTRIB command available in
MS-DOS. ATTR is a fully compatible superset of ATTRIB. You get all the
functionality of ATTRIB including the ability to:
* View file attributes.
* Change one or more file attributes.
* Process files in subdirectories.
* Change directory attributes
However, ATTR does more. With ATTR, you get the following new features that
the DOS ATTRIB command does not even offer:
* Multiple filenames on the same command line.
* The ability to exclude certain filenames from processing.
* The ability to only process files with certain attributes.
The only real difference between ATTR and ATTRIB is the action that occurs
when ATTR or ATTRIB is invoked without any command line arguments. ATTR will
show its help screen, while ATTRIB will list the attributes of all files in
the current directory. If you miss this feature, tell me when you register
ATTR Documentation Page 2 Copyright (C) 1994 by Thomas Dyas.
and I will make an effort to change it!
The only hardware and software requirements that ATTR needs is an IBM PC or
compatible running DOS version 2.0 or higher. In other words, ATTR will run
on any PC compatible available today.
Registration Information
------------------------
ATTR is released under the Shareware concept. This means that this software
is NOT in the public domain. I still retain the copyright to ATTR. If you
find ATTR useful for any reason whatsoever, you must register it with me or
stop using the program entirely. Registration only costs $7 and allows you
to remove all of the annoying "Register Me" messages that the shareware
version of ATTR will display every time you use the program. The enclosed
file REGISTER.TXT contains all of the information you will need to register
such as my address and a form you can print out containing all of the
information that I need.
You may only distribute ATTR if all of the files contained within the
archive are with the ATTR.EXE file. The reason for this requirement is
simple considering that people can only register ATTR with me if they have
the files that tell them how to register. The simplest method of
distribution would be to pass on the original archive!
License Information
-------------------
The following paragraph is the license information for ATTR. By using the
ATTR program, you automatically agree to be bound this license.
TKD Software and the author of ATTR, Thomas Dyas, disclaim all warranties
on the ATTR program, including all implied warranties of merchantability and
fitness. Furthermore, there are NO obligations or liability on the part of
Thomas Dyas or TKD Software or any other party for damages, including but
not limited to special, indirect, or consequential damages arising out of or
in connection with the use or performance of the ATTR program. By using the
shareware or registered forms of the ATTR.EXE program, you automatically
agree to be bound to all parts of this software license.
Installation
------------
By now, you have decompressed the archive that contains the ATTR.EXE program
file and the associated documentation files including this one. Just so you
can be thorough, here is a list of all the files that should be included in
the archive:
* ATTR.EXE This is the actual ATTR program. It IS the product. :)
* ATTR100.DOC The main documentation file for ATTR.
* REGISTER.TXT Instructions on how to register ATTR. Includes the
registration form.
* FILE_ID.DIZ A description file for BBS systems.
* READ.ME A quick reference to the files in the ATTR archive.
The only installation step is to copy the ATTR.EXE file into a directory
ATTR Documentation Page 3 Copyright (C) 1994 by Thomas Dyas.
listed in your PATH environment variable. The PATH setting tells DOS where
to find program files that are not in the current directory. For example,
you would not be able to access external DOS commands if your DOS directory
was not listed in your PATH statement. The simplest way to install ATTR
would be to copy the ATTR.EXE file into your DOS directory. Once this is
done, ATTR is ready to be run from any directory!
What are file attributes?
-------------------------
This is a good question since you cannot change what you don't know about.
Simply put, file attributes are special properties that DOS gives to a file
besides that file's name. Each attribute can either be on or off. At the
current time, there are four attributes available to files and directories.
The following list shows each attribute and what DOS and other programs use
it for. The letter that proceeds each description is the letter that ATTR
will use to refer to that attribute. All ATTR output and command line
arguments will use that letter to identify that attribute.
A Archive attribute- DOS uses this attribute to mark files that have been
modified since the last backup. Several commands such as XCOPY and BACKUP
can use this attribute to limit the number of files actually copied. When
a backup is done, this attribute would be turned off by the backup
program. DOS itself doesn't normally use this attribute. As you will see
in the Special Notes section, you can use this attribute to exclude files
from copying and other stuff.
R Read-only attribute- This attribute prevents a file from being deleted or
overwritten. Setting this attribute is a good way of protecting yourself
from accidentally deleting an important file! Some files that should have
this attribute would be COMMAND.COM, IO.SYS, and MSDOS.SYS. Files with
read-only status can be renamed however.
H Hidden attribute- Setting the hidden attribute will keep a file or
directory out of normal directory listings. This attribute will keep a
normal DIR command from displaying the file. However, the DIR /A command
under DOS versions 5.0 and higher will display a hidden file. Also,
hidden directories can still be accessed using the CD command.
S System attribute- This attribute is usually given only to the system
startup files IO.SYS and MSDOS.SYS. It identifies programs that are vital
to the system. IO.SYS and MSDOS.SYS fall into this category because they
ARE MS-DOS. System attribute files are hidden from normal directory
listings as if they were hidden. You never need to give your own files
this attribute.
Basic syntax of an ATTR command
-------------------------------
In all of the format lines that follow, anything surrounded by [] braces is
optional. A vertical bar | will separate items that are mutually exclusive.
You may enter only one item from this type of list and not any of the
others. Items separated by Items delimited by commas may be entered in any
order. You may also omit any of the items that you want from a comma list.
Finally, items listed in lower case describe a variable that you must
ATTR Documentation Page 4 Copyright (C) 1994 by Thomas Dyas.
replace such as "filename". Here you would replace "filename" with the
actual filename that you want. Ellipses (...) mean that you can repeat the
previous sequence as many times as you want.
Here is the basic format of an ATTR command:
ATTR [ [+|-,A,R,H,S] [switches] [filespec] ] ...
Notice that the entire command-line is optional. If you do not give ATTR any
parameters to process, it will display a small help screen. Of course, you
will probably be giving ATTR some parameters so that it does some actual
work! In this case, the most important parameter on the command-line is the
"filespec" parameter. The filespec tells ATTR what files it will access. You
can specify any valid path. You can include wildcards so that multiple files
can be accessed at once. Notice that the ellipses allow you to repeat this
entire block as many times as you want.
The "switches" part of the command-line will be described later. Valid
command switches change the default behavior of ATTR and allow you to
exclude files and do other stuff. All switches must precede the filespec
they will affect. Finally, the section marked as "[+|-,A,R,H,S]" is the
parameter that will tell ATTR to begin set file attributes.
ATTR operates in two modes. The first mode is to display the attributes of
each file that matches the filespec parameter. ATTR will continue in this
mode until you tell it to begin setting file attributes. Once ATTR begins to
set file attributes, you must use a command switch to reset it to the
attribute display mode. These two modes are simpler than you think. The next
two sections will explain all.
Viewing Attributes
------------------
When ATTR is in the attribute display mode, it will show a list of attribute
letters followed by the full pathname of a file. Each letter represents one
of the attribute letters that was listed in the chart above. Here is an
example command from my own hard drive:
C:\> attr *.sys t*.bat command.com
ATTR V1.00 Copyright (C) 1993 by Tom Dyas. All rights reserved.
.RHS C:\IO.SYS
.RHS C:\MSDOS.SYS
A... C:\TPX.BAT
A... C:\TC.BAT
.R.. C:\COMMAND.COM
Notice that if an attribute is set, its letter will be shown. If the
attribute is not set, a period will appear. The full pathname of the file is
displayed directly after the attribute list. To display file attributes, you
just have to give ATTR a list of filespec's. Nothing is better than a few
examples.
Examples of viewing attributes:
ATTR Documentation Page 5 Copyright (C) 1994 by Thomas Dyas.
ATTR *.bat a:*.*
Shows the attributes of all .BAT files in the current directory and the
attributes of all files in the current directory on drive A.
ATTR c:\bush*.com c:\windows\system\*.dll
Shows the attributes of all files that match BUSH*.COM in the root
directory of drive C, and the attributes of all .DLL files in the
\WINDOWS\SYSTEM directory on drive C.
ATTR *.*
Shows the attributes of all files in the current directory.
ATTR *.bat *.com *.exe
Shows the attributes of all .BAT, .COM, and .EXE files in the current
directory.
ATTR ..\rat*.txt e:\qwerty.com b:kaka*.*
Shows the attributes of all files that match RAT*.TXT in the current
directory's parent directory, the attributes of the file QWERTY.COM in the
root directory of drive E, and the attributes of all files that match
KAKA*.* in the current directory of drive B.
Setting the attributes of a file
--------------------------------
In order to change the attributes of a file, you must PRECEDE a file spec
with one or more attribute modifiers. Each modifier starts with a plus sign
(+) or a minus (-) followed by one or more of the four attribute letters.
Common sense tells you that the plus sign will set an attribute, while the
minus sign clears that attribute. The attribute modifiers will apply to all
filespecs that follow until you reset ATTR to the "view attribute" mode. As
ATTR changes the attributes of each file, it will display what attributes it
changed and the full path name of the file. Here is some sample output from
my own hard drive:
C:\>attr +h -a p*.bat
ATTR V1.00 Copyright (C) 1993 by Tom Dyas. All rights reserved.
A-..H+.. C:\PS.BAT
A-..H+.. C:\PSC.BAT
Notice that each attribute being changed is followed by a plus or minus sign
signifying the type of change. In this case, the archive attribute is being
cleared while the hidden attribute is being set on both files. If you would
like to set or clear more than one attribute, you can combine the letters of
the attributes you want to set or clear into a single attribute modifier.
The following examples will clarify this point even further.
Examples of setting attributes:
ATTR +a *.*
Sets the archive attribute of all files in the current directory
ATTR Documentation Page 6 Copyright (C) 1994 by Thomas Dyas.
ATTR -ar *.bak *.bat
Removes the archive and read-only attributes from all .BAK and .BAT files
in the current directory.
ATTR -a -r *.bak *.bat
Same as the above command. Notice that the attribute modifiers are
cumulative. In other words, the modifiers "add up".
ATTR +hr -a *.sys perot*.exe
This command will set the hidden and read-only attributes for all .SYS
files and perot*.exe files in the current directory. At the same time it
will clear the archive attribute for these files.
ATTR -r a:\*.bat +a *.exe
The read-only attribute will be cleared from all .BAT files in the root
directory of drive A. Next, the read-only attribute will be cleared from
all .EXE files in the current directory as the archive attribute is being
set. Note that the "-r" does not go away simply because another modifier is
listed in the command. If you want to "clear out" the modifiers to start
"fresh", you must use a command switch.
Command switches
----------------
ATTR accepts any number of command switches before a filespec so that you
can change the program's default behavior. You can exclude files from
processing and include files only with certain attributes. You can process
multiple directories recursively. You can also reset ATTR to the "view
attribute" mode. Command switches must PRECEDE the filespec that they modify
due to the way that ATTR processes the command line. Here they are in no
particular order:
/?
Shows the ATTR help message. You can also display the help message by
invoking ATTR with no command line parameters. The message gives you a
quick help reference when you cannot refer to this file. This switch is
also provided since other programs such as the DOS 5+ commands use this
switch to display a small help screen.
/S
This switch will cause ATTR to recurse through all of the subdirectories
under the next filespec. The /S switch only applies to the next filespec.
If you want it to apply to more than one filespec, you must specify /S
before each filespec in turn. Here are some examples:
ATTR /s \*.*
Display the attributes of every file on the current drive.
ATTR /s \tp\*.pas *.bak
This command will display the attributes of all .PAS files in the \TP
directory and any of the subdirectories under it. Then, the attributes of
all .BAK files in the current directory will be shown. The /S switch
doesn't apply to this second file spec since it wasn't specified right
before the filespec.
ATTR Documentation Page 7 Copyright (C) 1994 by Thomas Dyas.
ATTR +a /s a:\*.bat /s a:\*.com
This command will set the archive attribute of .BAT files on drive A. It
will also set the archive attribute of all .COM files on drive A since the
/S switch was specified before the second filespec.
/V
This switch resets ATTR to the "view attribute". ATTR will stop setting the
attributes of files and begin to display file attributes starting with the
next filespec. You can also use this switch to "clear out" ATTR and give
ATTR entirely new attributes to set. Here are some examples:
ATTR +r *.txt /v *.txt *.doc
This command will set the read-only attribute for all .TXT files in the
current directory. ATTR will then display the attributes for all .TXT and
.DOC files in the current directory. You get to see what a pretty job ATTR
did setting the read-only attribute.
ATTR +r dvorak*.* /v +h *.plo
This command will set the read-only attribute on all files that match
DVORAK*.* in the current directory. The /V switch will reset ATTR to the
"view attribute" mode. ATTR will then set the hidden attribute for all
.PLO files in the current directory. The /V switch "cleared out" the "+r"
modifier. Since ATTR reads parameters from left-to-right the /V must come
before the "+h" to clear out the "+r". If it didn't, ATTR would also clear
out the "+h" and display the attributes of all .PLO files!
/X[[:]exclude_path]
This command switch allows you to exclude files that match exclude_path
from processing. The /X switch will stay in effect for all filespecs that
follow it until you specify the /X switch again without any exclude_path.
The colon that comes between /X and exclude_path is optional. You can put
it in if you want. ATTR does not really care if you do. If you specify /X
without an exclude_path, ATTR will stop excluding files. Here are some
examples:
ATTR /x:t*.* *.bat *.exe /x *.com
This command will show the attributes of all .BAT and .EXE files in the
current directory except for files that match t*.*. The /X switch alone
stops the exclude mode. ATTR will then show the attributes of all files
that match *.COM.
ATTR +a /x*.com *.* a:\stuff\*.* /x /v /s b:\*.*
This command will set the archive attribute for all files in the current
directory and all files in the \STUFF directory of drive A except for
files that match *.com. ATTR will then show the attributes of all files in
all directories on drive B. This example is a good example of how the
switches can be combined.
/I[A,R,H,S,-,+]
The /I switch will force ATTR to only process files that have certain
attributes. You can specify if the attributes must be on or off. This
switch is similar to the /A switch of the DIR command in DOS versions 5.0
or higher. The /I switch will remain in effect for all following filespecs
ATTR Documentation Page 8 Copyright (C) 1994 by Thomas Dyas.
until you specify the switch again without any parameters. The attribute
letters that follow the /I switch must follow with no intervening space.
Each letter would force ATTR to accept only files with that attribute SET.
If the minus sign precedes an attribute letter, it will force ATTR to
accept files with that attribute CLEAR. Here are some examples:
ATTR /ia-h *.* /ir *.sys
This command will display the attributes of all files in the current
directory that have the archive attribute and do not have the hidden
attribute. ATTR will then display the attributes of all .SYS files in the
current directory that have the read-only attribute.
ATTR +a /ir a:\dev\*.com /v /x:psc.bat *.bat
This command will set the archive attribute for all *.COM files in the
\DEV directory on drive A that have the read-only attribute. ATTR will
then display the attributes of all *.BAT files in the current directory
that have the read-only attribute except for the file PSC.BAT. This is
another good combination example.
/P-|+
This switch will turn the file protection feature on and off. By default,
ATTR will protect all files with the hidden AND system attributes from
having their attributes changed. This behavior is designed to protect the
MS-DOS startup files IO.SYS and MSDOS.SYS from attribute modification
unless you REALLY mean it. These two files normally have both the hidden
and system attributes. This is a safety feature. ATTRIB has this behavior
by default except that you must remove the system and hidden attributes
first. The protection switch is must simpler. Here is an example:
ATTR -hs io.sys /p- io.sys
The first filespec will not remove the hidden and system attributes from
IO.SYS since protection is on by default. The second filespec will modify
the IO.SYS file since the /P- switch removes protection. If you want to
turn protection feature back on in the same command line use the /P+
switch.
Special notes and tips
----------------------
DIRECTORY ATTRIBUTES: The first special note regards setting the attributes
of directories. Using ATTR you can hide directories by giving them the
hidden attribute. The directories will not be visible in normal directory
listings unless the DIR /A switch is used. To set the attributes of a
directory, the filespec must match the directory name exactly with the
following backslash. You do not have to include the full pathname as in the
following examples if the directory is in the current directory. Treat the
directory as a file that you must name exactly. Here are some examples:
ATTR +h c:\dos
This command will hide the \DOS directory on drive C.
ATTR -h util
This command will "un-hide" the UTIL directory under the current directory.
ATTR +h c:\dos*.*
ATTR Documentation Page 9 Copyright (C) 1994 by Thomas Dyas.
This command will NOT hide the C:\DOS directory since the filespec does not
match the directory name exactly.
USING THE ARCHIVE ATTRIBUTE TO EXCLUDE FILES WITH XCOPY: Using the archive
attribute with ATTR, you can use XCOPY to copy only certain files. First,
you must clear the archive attribute from all files in the directory you
want to copy. Next, set the archive attribute for all files you want to
copy. Then, use XCOPY with the /A switch or /M switch to copy only files
with the archive attribute. It may make your life much easier! Here is a
sample run without output:
C:\STUFF> attr -a *.* +a /x:george*.* *.bat
[Remove the archive attribute from all files in the current directory, then
set the archive attribute for all *.BAT files except for files matching
GEORGE*.*]
C:\STUFF> xcopy *.* b:\ /a
[XCOPY will copy all files with the archive attribute set in the current
directory to the root directory of drive B. It is that simple!]
Technical Support
-----------------
Technical support for ATTR and any other programs that I have written can
come to me through several sources. If you want to send me postal mail, send
your questions and comments to the following address:
TKD Software
P.O. Box 211
Metuchen, NJ 08840
If you have access to Internet electronic mail, send a mail message to:
tom.dyas@f331.n107.z1.fidonet.org
If you have FidoNet netmail access, send a mail message to:
Tom Dyas at node 1:107/331
I will try to answer your questions and improve ATTR using your comments.
Registered users will get first priority over all other people. If you want
first priority, register with me using the instructions in REGISTER.TXT!